package com.dnjn.happiness.job.api;

import com.dnjn.happiness.common.core.constant.SecurityConstants;
import com.dnjn.happiness.common.core.constant.ServiceNameConstants;
import com.dnjn.happiness.common.core.domain.R;
import com.dnjn.happiness.common.core.web.domain.AjaxResult;
import com.dnjn.happiness.common.core.model.SysJobVO;
import com.dnjn.happiness.job.api.factory.RemoteJobFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteJobService",value = ServiceNameConstants.JOB_SERVICE,fallbackFactory = RemoteJobFallbackFactory.class)
public interface RemoteJobService {

    /**
     * 新增定时任务
     */
    @PostMapping("/job/insertJob")
    public AjaxResult insertJob(@RequestBody SysJobVO sysJobVO, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;

    /**
     * 修改定时任务
     */
    @PutMapping("/job/updateJob")
    public R updateJob(@RequestBody SysJobVO sysJobVO, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;


    /**
     * 获取定时任务详细信息
     */
    @GetMapping("/job/getInfoById/{jobId}")
    public R<SysJobVO> getInfoById(@PathVariable("jobId") Long jobId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 定时任务状态修改
     */
    @PutMapping("/job/changeStatusApi")
    public R changeStatusApi(@RequestBody SysJobVO sysJobVO, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
